package com.epfresh.api.entity;

import com.google.gson.Gson;

/**
 * Created by wzh on 2016/3/21.
 */
public class User {

    private String access_token;
    private String refresh_token;
    private String scope;
    private String token_type;
    private String jti;

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    private String accountId;
    private String phone;
    private String password;
    private String status;
    private String nickname;
    private int consigneeCount;
    private boolean hasDeliveryAddress;
    private boolean hasConsignee;
    private boolean hasCert;
    private int deliveryAddressCount;
    private int pickUpAddressCount;
    private int certStatus;
    private String avatar;
    //用于标识新的登录接口的token
    /*private String accessToke;
    public String getAccessToke() {
        return accessToke;
    }

    public void setAccessToke(String accessToke) {
        this.accessToke = accessToke;
    }*/
    //用于标示user是否为最新
    private String tag;

    public User() {

    }

    public int getPickUpAddressCount() {
        return pickUpAddressCount;
    }

    public void setPickUpAddressCount(int pickUpAddressCount) {
        this.pickUpAddressCount = pickUpAddressCount;
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public int getConsigneeCount() {
        return consigneeCount;
    }

    public void setConsigneeCount(int consigneeCount) {
        this.consigneeCount = consigneeCount;
    }

    public boolean isHasDeliveryAddress() {
        return hasDeliveryAddress;
    }

    public void setHasDeliveryAddress(boolean hasDeliveryAddress) {
        this.hasDeliveryAddress = hasDeliveryAddress;
    }

    public boolean isHasConsignee() {
        return hasConsignee;
    }

    public void setHasConsignee(boolean hasConsignee) {
        this.hasConsignee = hasConsignee;
    }

    public boolean isHasCert() {
        return hasCert;
    }

    public void setHasCert(boolean hasCert) {
        this.hasCert = hasCert;
    }

    public int getDeliveryAddressCount() {
        return deliveryAddressCount;
    }

    public void setDeliveryAddressCount(int deliveryAddressCount) {
        this.deliveryAddressCount = deliveryAddressCount;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public int getCertStatus() {
        return certStatus;
    }

    public void setCertStatus(int certStatus) {
        this.certStatus = certStatus;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public void addDeliveryAddressCount() {
        deliveryAddressCount++;
    }

    public void delDeliveryAddressCount() {
        deliveryAddressCount--;
    }

    public void addConsigneeCount() {
        consigneeCount++;
    }

    public void delConsigneeCount() {
        consigneeCount--;
    }
    @Override
    public String toString() {
        return new Gson().toJson(this);
    }

    public String encryptUser() {
        //可以再加密
        return new Gson().toJson(this);
    }

    public static User decryptUser(String encryptStr) {
        //可以增加解密
        return new Gson().fromJson(encryptStr, User.class);
    }


}
